import http from "@/utils/http";

/**
 * 查询模板列表
 */
export const listTemplate = () => {
  return http.get("/crm/task/template/list");
};

/**
 * 新增模板
 */
export const addTemplate = (data: any) => {
  return http.post("/crm/task/template/add", data);
};

/**
 * 编辑模板
 */
export const editTemplate = (data: any, packageId: any) => {
  return http.put(`/crm/task/template/edit/${packageId}`, data);
};

/**
 * 删除模板
 */
export const delTemplate = (packageId: any) => {
  return http.deleteMethod(`/crm/reform/template/del/${packageId}`);
};

/**
 * 模板任务列表
 */
export const taskListByPackageId = (packageId: any) => {
  return http.get(`/crm/task/template/taskSettings/${packageId}`);
};

/**
 * 新增任务
 */
export const addTask = (data: any) => {
  return http.post("/crm/task/template/taskSettings/add", data);
};

/**
 * 编辑任务
 */
export const editTask = (data: any, taskSettingId: any) => {
  return http.post(`/crm/task/template/taskSettings/edit/${taskSettingId}`, data);
};

/**
 * 启用/禁用任务
 */
export const updateTaskStatus = (taskSettingId: any, params: { status: any }) => {
  return http.put(`/crm/task/template/taskSettings/changeStatus/${taskSettingId}/${params.status}`);
};

/**
 * 删除任务
 */
export const delTask = (taskSettingId: any) => {
  return http.deleteMethod(`/crm/task/template/taskSettings/deleteTask/${taskSettingId}`);
};

/**
 * 查询整改模板任务可选前置任务列表
 */
export const optionalBeforeTaskList = (packageId: string) => {
  return http.get(`/crm/task/template/optionalBeforeTaskList/${packageId}`);
};
